/* 
    函数的参数可以是任何类型
    常用的类型如下：
    1、基础类型
    2、数组类型
    3、对象类型
    4、默认值
    5、可选参数
    6、不定参数
*/
function printStr(ary:string[]):string{
    return ary.join("、")
}
let result:string=printStr(["apple","orange","banana"])
console.log(result);
console.log('______________________________');
function printPersonInfo(person:{name:string,age:number,hobby:string[]}){
    return `我叫${person.name},我今年${person.age},我的爱好是${person.hobby.join("、")}`
}
let p1={
    name:'Giles',
    age:38,
    hobby:['singsong','dance','write program','flush wan']
}
let r3:string=printPersonInfo(p1)
console.log(r3);
console.log('*****************************');
function show(name:string,age:number=18){
    return `我叫${name},今年${age}`
}
console.log(show("Giles",38));
console.log(show("zhaijizhe"));
console.log('**************************');

function showInfo(name:string,sex?:string){
    let sexInfo=sex?'我是个'+sex+"的":''
    return `我叫${name} ${sexInfo}`
}
let r4:string=showInfo("Giles","男")
console.log(r4);
let r5:string=showInfo("花花")
console.log(r5);
console.log("*******************");

function printNumber(a:number,...b:number[]){
    let ary=[a,...b]
    ary.forEach(item=>{
        console.log(item);
        
    })
}
printNumber(1,5,6,7,8,11)






 


